#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
#include <math.h>

int main() {
    int n, m;
    while (scanf("%d %d", &n, &m) != EOF)
    {
        int i = 0;
        int sum = 0;
        for (i = 1; i < m; i++)
        {
            sum += n;
            n = sqrt(n);
        }
        printf("%d\n", sum);
    }
    return 0;
}